package cn.ddiancan.xddcloud.psc.flow.engine.core;

import java.io.Serializable;

import lombok.Getter;

/**
 * 流程创建者
 * @since 1.0
 */
@Getter
public class FlowCreator implements Serializable {

    /**
     * 租户ID
     */
    private String tenantId;

    /**
     * 创建人ID
     */
    private String createName;

    /**
     * 创建人
     */
    private Long createBy;

    /**
     * 初始化管理员，用于操作权限忽略等场景
     */
    public static final FlowCreator ADMIN = new FlowCreator("admin", 0L);

    public FlowCreator(String createName, Long createBy) {
        this.createName = createName;
        this.createBy = createBy;
    }

    public FlowCreator tenantId(String tenantId) {
        this.tenantId = tenantId;
        return this;
    }

    public static FlowCreator of(String createName, Long createBy) {
        return of(null, createName, createBy);
    }

    public static FlowCreator of(String tenantId, String createName, Long createBy) {
        return new FlowCreator(createName, createBy).tenantId(tenantId);
    }
}
